import axios from '../../http'

function getNewID () {
  return new Promise(function (resolve) {
    axios
      .post('commonRest/getNewId')
      .then(res => {
        resolve('new' + res.data)
      })
  })
}

function selectList (data) {
  return new Promise(function (resolve) {
    axios
      .post('commonRest/selectList', {
        ...data
      })
      .then(res => {
        resolve(res.data)
      })
  })
}

function selectOne (data) {
  return new Promise(function (resolve) {
    axios
    .post('commonRest/selectOne', {
        ...data
    })
    .then(res => {
      resolve(res.data)
    })
  })
}

function selectPage (data) {
  return new Promise(function (resolve) {
    axios
    .post('commonRest/selectPage', {
      ...data
    })
    .then(res => {
      resolve(res.data)
    })
  })
}
export default {
  getNewID,
  selectList,
  selectOne,
  selectPage
}